package com.xiaobai.config;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.stereotype.Component;

/**
 * @author yangdaji
 * @version 1.0
 * @Description: 资源服务配置
 * @date 22-2-19 上午 2:02
 */
@Component
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {


    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                //所有请求需要认证
                .anyRequest()
                .authenticated()
                .and()
                //但匹配到指定路径是不需要认证
                .requestMatchers()
                .antMatchers("/user/**");
    }
}
